package com.softtown.modules.workflow.dao;

import com.softtown.common.dao.BaseDao;
import com.softtown.modules.workflow.entity.SwfLastAprvReqEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: Dingyayong
 * @Date: 2019/9/23 15:01
 * @Description:
 */
@Mapper
public interface SwfLastAprvReqDao extends BaseDao<SwfLastAprvReqEntity> {

    /**
     * 根据公司和审批段id查找出差审批的部门要求
     * @param compId
     * @param phaseId
     * @return com.softtown.modules.entity.SwfLastAprvReqEntity
     * @Author fuming
     * @Date 2020/5/27 17:22
     */
    SwfLastAprvReqEntity findLastAprvReqByDeptAndTravel(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 根据公司和审批段id查找报销审批的部门要求
     * @param compId
     * @param phaseId
     * @return com.softtown.modules.entity.SwfLastAprvReqEntity
     * @Author fuming
     * @Date 2020/5/27 17:23
     */
    SwfLastAprvReqEntity findLastAprvReqByDeptAndExpense(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 根据公司和审批段id,条件为费目来查查找出差审批的岗位要求
     * @param compId
     * @param phaseId
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @Author fuming
     * @Date 2020/5/27 17:23
     */
    List<SwfLastAprvReqEntity> findLastAprvReqByItemAndTravel(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 根据公司和审批段id,条件为费目来查查找报销审批的岗位要求
     * @param compId
     * @param phaseId
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @Author fuming
     * @Date 2020/5/27 17:23
     */
    List<SwfLastAprvReqEntity> findLastAprvReqByItemAndExpense(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 根据公司和审批段id,条件为金额来查查找出差审批的岗位要求
     * @param compId
     * @param phaseId
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @Author fuming
     * @Date 2020/5/27 17:24
     */
    List<SwfLastAprvReqEntity> findLastAprvReqByMoneyAndTravel(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 根据公司和审批段id,条件为金额来查查找报销审批的岗位要求
     * @param compId
     * @param phaseId
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @Author fuming
     * @Date 2020/5/27 17:24
     */
    List<SwfLastAprvReqEntity> findLastAprvReqByMoneyAndExpense(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 根据公司和单据类型,来获取审批段设置
     * @param compId
     * @param docTypeValue
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @Author fuming
     * @Date 2020/5/27 17:24
     */
    List<SwfLastAprvReqEntity> getSwfLastAprvReqInfo(@Param("compId") Long compId, @Param("docTypeValue") String docTypeValue);

    /**
     * 根据公司和单据类型,来获取审批段设置
     * @param compId
     * @param docTypeValue
     * @param phaseId
     * @param reqType
     * @param condType
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @Author fuming
     * @Date 2020/5/27 17:25
     */
    List<SwfLastAprvReqEntity> findLastAprvReqByReqAndCondType(@Param("compId") Long compId, @Param("docTypeValue") String docTypeValue, @Param("phaseId") Long phaseId, @Param("reqType") String reqType, @Param("condType") String condType);

    /**
     * 根据公司和审批段id查找借款审批的部门要求
     *
     * @param compId
     * @param phaseId
     * @return com.softtown.modules.entity.SwfLastAprvReqEntity
     * @author fuming
     * @date 2019/10/30 14:59
     */
    SwfLastAprvReqEntity findLastAprvReqByDeptAndAdv(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 根据公司和审批段id条件为费目来查找借款审批的岗位要求
     *
     * @param compId
     * @param phaseId
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @author fuming
     * @date 2019/10/30 15:05
     */
    List<SwfLastAprvReqEntity> findLastAprvReqByItemAndAdv(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 根据公司和审批段id条件为金额来查找借款审批的岗位要求
     *
     * @param compId
     * @param phaseId
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @author fuming
     * @date 2019/10/30 15:09
     */
    List<SwfLastAprvReqEntity> findLastAprvReqByMoneyAndAdv(@Param("compId") Long compId, @Param("phaseId") Long phaseId);

    /**
     * 更新最终审批结果
     * @param swfLastAprvReqEntity
     * @return void
     * @Author fuming
     * @Date 2020/5/27 17:25
     */
    void updateLastAprvReq(SwfLastAprvReqEntity swfLastAprvReqEntity);

    /**
     * 找出公司单据类型审批段对应的部门最终审资格设置
     * @param compId
     * @param phaseId
     * @param docTypeValue
     * @return com.softtown.modules.entity.SwfLastAprvReqEntity
     * @Author fuming
     * @Date 2020/5/27 17:26
     */
    SwfLastAprvReqEntity findLastAprvReqByPhaseAndDocType(@Param("compId") Long compId, @Param("phaseId") Long phaseId, @Param("docTypeValue") String docTypeValue);

    /**
     * 找出公司单据类型审批段对应的岗位最终审资格设置
     * @param compId
     * @param phaseId
     * @param docTypeValue
     * @return java.util.List<com.softtown.modules.entity.SwfLastAprvReqEntity>
     * @Author fuming
     * @Date 2020/5/27 17:27
     */
    List<SwfLastAprvReqEntity> findLastAprvReqByPhaseAndDocTypeAndReq(@Param("compId") Long compId, @Param("phaseId") Long phaseId, @Param("docTypeValue") String docTypeValue);
}
